from rest_framework import serializers

from datasource.models import OpTypeList
from dvadmin.utils.serializers import CustomModelSerializer
from dvadmin.utils.viewset import CustomModelViewSet


class OpTypeSerializer(CustomModelSerializer):

    class Meta:
        model = OpTypeList
        fields = "__all__"

    def create(self, validated_data):
        return super().create(validated_data)
class OpTypeViewSet(CustomModelViewSet):
    """
    算子种类管理接口
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """
    queryset = OpTypeList.objects.all()
    serializer_class = OpTypeSerializer
    filter_fields = ['name', ]
    permission_classes = []
